package com.vo;
/**
 * 订货数据表实体类
 */

import com.bean.Commodity;
import com.bean.PlaceOrder;

import java.io.Serializable;
import java.util.Date;

public class PlaceOrderVo implements Serializable {
    /*主键*/
    private String id;
    /*订货订单id*/
    private String orderId;
    /*商品id，引用商品信息表的id获取想要的信息*/
    private String commodityId;
    /*商品数量*/
    private String commodityCount;
    /*订货日期*/
    private Date orderDate;
    /*订货单状态*/
    private String commodityStaus;
    /*总金额*/
    private String totalPrice;

    //对象
    private Commodity commodity;

    public Commodity getCommodity() {
        return commodity;
    }

    public void setCommodity(Commodity commodity) {
        this.commodity = commodity;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public String getCommodityId() {
        return commodityId;
    }

    public void setCommodityId(String commodityId) {
        this.commodityId = commodityId;
    }

    public String getCommodityCount() {
        return commodityCount;
    }

    public void setCommodityCount(String commodityCount) {
        this.commodityCount = commodityCount;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public String getCommodityStaus() {
        return commodityStaus;
    }

    public void setCommodityStaus(String commodityStaus) {
        this.commodityStaus = commodityStaus;
    }

    public String getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(String totalPrice) {
        this.totalPrice = totalPrice;
    }

    public PlaceOrderVo(String id, String orderId, String commodityId, String commodityCount, Date orderDate, String commodityStaus, String totalPrice) {
        this.id = id;
        this.orderId = orderId;
        this.commodityId = commodityId;
        this.commodityCount = commodityCount;
        this.orderDate = orderDate;
        this.commodityStaus = commodityStaus;
        this.totalPrice = totalPrice;
    }

    public PlaceOrderVo(String id, String orderId, String commodityId, String commodityCount, Date orderDate, String commodityStaus, String totalPrice, Commodity commodity) {
        this.id = id;
        this.orderId = orderId;
        this.commodityId = commodityId;
        this.commodityCount = commodityCount;
        this.orderDate = orderDate;
        this.commodityStaus = commodityStaus;
        this.totalPrice = totalPrice;
        this.commodity = commodity;
    }
//
//    public PlaceOrderVo(Long orderId, Integer commodityId, int commodityCount, Date date, int i, Double totalPrice) {
//    }


    public PlaceOrderVo() {
    }

    public PlaceOrder parse(){

        PlaceOrder placeOrder = new com.bean.PlaceOrder();

        try {
            placeOrder.setId(Integer.valueOf(this.id));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        try {
            placeOrder.setOrderId(Integer.valueOf(this.orderId));
        } catch (Exception e) {
//            e.printStackTrace();
        }
//        try {
//            placeOrder.setCommodityId(Integer.valueOf(this.commodityId));
//        } catch (Exception e) {
////            e.printStackTrace();
//        }
//
//        try {
//            placeOrder.setCommodityCount(Integer.valueOf(this.commodityCount));
//        } catch (Exception e) {
////            e.printStackTrace();
//        }


        try {
            placeOrder.setCommodityStaus(Integer.valueOf(this.commodityStaus));
        } catch (Exception e) {
//            e.printStackTrace();
        }

        try {
            placeOrder.setTotalPrice(Double.valueOf(this.totalPrice));
        } catch (Exception e) {
//            e.printStackTrace();
        }
        placeOrder.setOrderDate(this.getOrderDate());

        return placeOrder;
    }

    @Override
    public String toString() {
        return "PlaceOrderVo{" +
                "id='" + id + '\'' +
                ", orderId='" + orderId + '\'' +
                ", commodityId='" + commodityId + '\'' +
                ", commodityCount='" + commodityCount + '\'' +
                ", orderDate=" + orderDate +
                ", commodityStaus='" + commodityStaus + '\'' +
                ", totalPrice='" + totalPrice + '\'' +
                ", commodity=" + commodity +
                '}';
    }
}
